package com.fs.ibox_h.servie.impl;

import com.fs.ibox_h.dao.CollectionDao;
import com.fs.ibox_h.dao.impl.CollectionDaoimpl;
import com.fs.ibox_h.pojo.Collection;
import com.fs.ibox_h.servie.CollectionService;
import com.fs.ibox_h.util.BeanFactory;
import com.fs.ibox_h.vo.CollectionCondition;
import com.fs.ibox_h.vo.Page;

import java.util.List;

/**
 * Author:HOU
 * date:2022/11/18  17:37
 * 案例:
 **/
public class CollectionServiceimpl implements CollectionService {
    CollectionDao classifyDao = BeanFactory.createBean(CollectionDao.class);


    @Override
    public void addcollection(Collection collection) {
        classifyDao.addCollection(collection);

    }

    @Override
    public List<Collection> selectAll() {
        return classifyDao.selectAll();
    }

    @Override
    public Page<Collection> selceByCondition(int currentPageInt, int pageSizeInt, CollectionCondition collectionCondition) {
        Page<Collection> page = new Page<>(currentPageInt,pageSizeInt);
        page.setCount(classifyDao.count(collectionCondition));
//        page.setCount(CollectionDao.count(collectionCondition)); //总记录数
//        page.setRecodes(CollectionDao.selectByPage(currentPageInt,pageSizeInt));
//        return classifyDao.selectByCnameState(currentPageInt,pageSizeInt,collectionCondition);
          page.setRecords(classifyDao.selectByCnameState(currentPageInt,pageSizeInt,collectionCondition));
        return page;
    }

//    @Override
//    public int getcount(CollectionCondition collectionCondition) {
//        return classifyDao.count(collectionCondition);
//    }
}
